package thinkingJava.chapter18;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Test {
	public static void main(String[] args) {
		InputStream in = null;
		Properties p = new Properties();

		try {
			in = Thread.currentThread().getContextClassLoader().getResourceAsStream("a.properties");
			if (in != null) {
				p.load(in);
				String name = p.getProperty("a.name", "default Value");
				String url = p.getProperty("a.url","default url");
				System.out.println("Name : " + name);
				System.out.println("Url : " + url);
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (in != null) {
				try {
					in.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}

	}
}
